<template>
	<view class="product_details"  :style="{ direction: $store.state.dir }">
		<view class="house-navbar">
			<status-bar></status-bar>
			<view class="house-navbar-tool">
				<image src="/static/back_icon.png" @click.stop="handleBack" mode=""></image>
			</view>
		</view>
		<view class="house-images" v-if="details.imgurls">
			<u-swiper radius="0" :height="swipeHeight" :autoplay="false"
				:list="details.imgurls ? details.imgurls.split(',') : []" indicator indicatorMode="line"></u-swiper>
		</view>
		<view class="product_wrap">
			<view class="product_title">
				<p>{{details.discount_price}}Egp</p>
				<text>{{details.origin_price}}Egp</text>
			</view>
			<text>Total discount {{details.discount}}%</text>
			<view class="product_header">
				{{details.name}}
			</view>
			<view class="product_text">
				{{details.introduce}}
			</view>
		
		</view>
		<view class="product_img" v-if="details.detailurls">
			<image v-for="(item,index) in details.detailurls.split(',')" :key="index" :src="item" mode="widthFix"></image>
		</view>
	</view>
</template>

<script>
	import {getItemDetail} from "@/lib/business.js"
	export default {
		data() {
			return {
				swipeHeight: 298,
				details: {},
				itemid:"",
			}
		},
		onLoad(options) {
			this.itemid = options.itemid;
			this.getData(this.itemid);
		},
		methods: {
			getData(id) {
				getItemDetail({itemid:this.itemid}).then((res) => {
					this.details = res.data;

				});
			},
			handleBack(){
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.house-navbar {
		position: fixed;
		left: 10px;
		right: 10px;
		top: 10px;
		height: 60px;
		z-index: 9999;
	
		&-tool {
			display: flex;
			align-items: center;
			justify-content: space-between;
			image{
				width: 48rpx;
				height: 48rpx;
			}
		}
	}
	.product_wrap{
		padding: 30rpx;
		.product_title{
			display: flex;
			align-items: center;
			justify-content: space-between;
			p{
				font-size: 44rpx;
				font-weight: bold;
				color: #FA751F;
			}
			text{
				font-size: 28rpx;
				font-weight: 400;
				color: #999999;
				display: inline-block;
				text-decoration: line-through;
			}
		}
		>text{
			font-size: 24rpx;
			font-weight: 400;
			color: #FA751F;
			display: block;
			}
			.product_header{
				font-family: Manrope, Manrope;
				font-weight: bold;
				font-size: 44rpx;
				color: #1C120D;
				padding-top: 12rpx;
			}
			.product_text{
				font-family: Manrope, Manrope;
				font-weight: 400;
				font-size: 30rpx;
				color: #666666;
				padding: 20rpx 0;
			}
	}
	.product_img{
		width: 100%;
		image{
			width: 100%;
			display: block;
		}
	}
</style>